-
Notifications
You must be signed in to change notification settings - Fork 45
feat: add currentIp option atlas-create-access-list tool #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/common/atlas/apiClient.ts
Outdated
@@ -252,6 +252,30 @@ export class ApiClient { | |||
} | |||
} | |||
|
|||
async getIpInfo() { | |||
await this.validateToken(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check the return of this call?
src/common/atlas/apiClient.ts
Outdated
method: "GET", | ||
headers: { | ||
Accept: "application/json", | ||
Authorization: `Bearer ${this.token?.access_token}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Assuming this.token is never null if this.validateToken
returned successfully.
Authorization: `Bearer ${this.token?.access_token}`, | |
Authorization: `Bearer ${this.token!.access_token}`, |
src/tools/atlas/createAccessList.ts
Outdated
@@ -36,6 +38,16 @@ export class CreateAccessListTool extends AtlasToolBase { | |||
comment: comment || DEFAULT_COMMENT, | |||
})); | |||
|
|||
if (currentIpAddress) { | |||
const currentIp = await this.apiClient!.getIpInfo(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const currentIp = await this.apiClient!.getIpInfo(); | |
const currentIp = await this.apiClient.getIpInfo(); |
fixes #36